package com.temple.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.template.mapper.UserMapper;
import com.temple.service.IUserService;
import com.temple.model.entity.User;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author yanchao
 * @since 2021-12-29
 */
@Service
@AllArgsConstructor
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    private final UserMapper userMapper;

    @Override
    public Boolean putFeature(Integer id, String key, Object value) {
        return userMapper.putFeature(id,key,value) >0;
    }

    @Override
    public Object getFeature(Integer id, String key) {
        return userMapper.getFeature(id,key);
    }

//    @Override
//    public Boolean updateUseName(Integer id, String userName) {
//        return userMapper.updateUseName(id,userName)>0;
//    }


    @Override
    public Boolean branchFeature(Integer id, Map<String, Object> value) {
        return userMapper.putFeatures(id, value) > 0;
    }

    @Override
    public Map<String, Object> getBranchFeature(Integer id, List<String> keys) {
        return userMapper.getFeatures(id,keys);
    }
}
